<%@ page contentType="text/html; charset=UTF-8" language="java" import="com.util.*,java.util.*" errorPage="/error.jsp" %>
<%@ page import="com.beans.log.*" %>
<%@ page import="com.business.log.*" %>
<%@ page import="com.beans.link.*" %>
<%@ page import="com.business.link.*" %>
<%@ page import="com.beans.user.*" %>
<%@ page import="com.business.user.*" %>
<%  
	String logNo=request.getPathInfo();
	String logNoStr=logNo;
    logNo=logNo.replace(".html","");
    logNo=logNo.replace("/","");
	   if(logNo==null) {
		response.sendRedirect("/error.jsp");
	}
	LogListBus llb=new LogListBus();
		if(session.getAttribute("logNos")==null){
			session.setAttribute("logNos",logNo);
			llb.addViewCount(logNo);
		}else{
		String logNos=(String)session.getAttribute("logNos");
		if(logNos.indexOf(logNo)==-1){
		logNos+=logNo;
		session.setAttribute("logNos",logNos);
		llb.addViewCount(logNo);}
		}
	
	LogInfo li=llb.getLogByNo(logNo);
	String username=li.getLogAuthor();
	UserListBus uis=new UserListBus();
	UserInfo ui=uis.getUserInfo(username);
	LogReplyBus lrb=new LogReplyBus();
    List replyList=lrb.getReplyByLogNo(logNo);
	LogTypeBus ltb=new LogTypeBus();
	int typeId=Integer.parseInt(li.getLogtypeId());
	LogType lt=ltb.getLogTypeById(typeId);
	String title=li.getLogTitle();
	%>
<%@ include file="/header.jsp"%>
<body>
<a name="top"></a>
<div id=container>
<%@ include file="/top.jsp"%>
<div id=Tbody>
<div id=mainContent>
<div id=innermainContent>
<div id=mainContent-topimg></div>
<div class=content-width id=Content_ContentList>
<div class=pageContent>

<div style="FLOAT: right; WIDTH: auto"><%if(!lt.getLogtypeName().equals("")){%><A title="订阅<%=lt.getLogtypeName()%>"
href="feed/<%=username%>/<%=lt.getLogtypeId()%>.html" target=_blank><IMG 
style="MARGIN-BOTTOM: -1px" alt="订阅所有<%=lt.getLogtypeName()%>"
src="images/rss.png" border=0> 订阅</A>|  <%}%><%if(!((LogInfo)llb.getFrontLog(username,logNo)).getLogTitle().equals("")){%><A 
title="上一篇日志: <%=((LogInfo)llb.getFrontLog(username,logNo)).getLogTitle()%>" 
href="log/temp/<%=((LogInfo)llb.getFrontLog(username,logNo)).getLogNo()%>.html"><IMG alt="" 
src="images/Cprevious.gif" border=0>上一篇</A><%} else{%><IMG alt="" 
src="images/Cprevious.gif" border=0>上一篇<%}%> | <%if(!((LogInfo)llb.getNextLog(username,logNo)).getLogTitle().equals("")){%><A 
title="下一篇日志: <%=((LogInfo)llb.getNextLog(username,logNo)).getLogTitle()%>"  href="log/temp/<%=((LogInfo)llb.getNextLog(username,logNo)).getLogNo()%>.html"><IMG alt="" 
src="images/Cnext.gif" border=0>下一篇</A> <%}else{%><IMG alt="" 
src="images/Cnext.gif" border=0>下一篇<%}%></div><%if(!lt.getLogtypeName().equals("")){%><IMG style="MARGIN: 0px 2px -4px 0px" alt="" src="images/6.gif"> <strong><A title="<%=lt.getLogtypeMemo()%>" href="show/<%=username%>/<%=lt.getLogtypeId()%>.html"><%=lt.getLogtypeName()%> </A></strong><%}%></div>
<div class=Content>
<div class=Content-top>
<div class=ContentLeft></div>
<div class=ContentRight></div>
<h1 class=ContentTitle><font color="#009193"><%=li.getLogTitle()%> </font></h1>
<h2 class=ContentAuthor>作者:<%=li.getLogAuthor()%>  日期:<%=li.getLogPostTime()%></h2></div>
<div class=Content-Info>
<div class=InfoAuthor><IMG 
style="MARGIN: 0px 2px -4px 0px" alt="" 
src="images/From.gif"><strong>文章类型:</strong> 
<%=li.getLogCategory().equals("0")?"原创":(li.getLogCategory().equals("1")?"转载":"翻译")%> <%LogFavorBus lfb=new LogFavorBus();
		if(session.getAttribute("login_user")!=null) {
	if(!lfb.IsFavor((String)session.getAttribute("login_user"),logNo)){
%>   &nbsp;&nbsp; <a href="add/<%=logNo%>.html">收藏这篇日志</a>
<%
	}
 }%></div>
</div>
<div class=Content-body 
id=logPanel>
<%=li.getLogContent()%>
</div>
<DIV class=Content-bottom>
<DIV class=ContentBLeft></DIV>
<DIV class=ContentBRight></DIV>回复: <%=replyList.size()%></A> |  
查看次数:<%=li.getViewnums()%></DIV>
<div class=Content-body>
<IMG style="MARGIN: 4px 2px -4px 0px" alt="" src="images/tag.gif"><strong>Tags:<%=li.getLogTag().equals("")?"无":li.getLogTag()%></strong>
 <%/*
 if(li.getLogTag()!=null){
 String str;
 StringTokenizer st = new StringTokenizer(li.getLogTag(), ",");
 	for (int i = 0; i < st.countTokens(); i++) {
				str = st.nextToken();
				%>
				 <A href="tag/temp/<%=str%>.html">
<%=str%>&nbsp;&nbsp;&nbsp;&nbsp;
 </A>
 <%		}

	}*/
%>
<P><strong>相关文章:</strong></p>
<% List tagList=llb.getLogByTag(li.getLogTag());
String tagStr="";
if(tagList.size()<=0){
%> 无<br /><%}else{
for(int i=0;i<tagList.size();i++) {
LogInfo liTag=(LogInfo)tagList.get(i);
if(!liTag.getLogNo().equals(logNo)) {
	
%>
<a title="<%=liTag.getLogIntro()%>" href="log/temp/<%=liTag.getLogNo()%>.html"><%=liTag.getLogTitle()%></a><br/>
<%
	}
	}
}
%>
</div>
</div></div>
<div class=comment>
<% 
if(replyList==null||replyList.size()==0) {
%>
<br/>
<b>
还没有回复此日志
</b>
<% } else {
 for(int i=0;i<replyList.size();i++) {
 LogReply lr=(LogReply)replyList.get(i); 
 //System.out.println((String)session.getAttribute("password"));
 %>
<div class=commenttop><IMG style="MARGIN: 0px 4px -3px 0px" alt="" 
src="images/icon_quote.gif" border=0></a><A 
href="about/<%=lr.getNickname()%>/"><strong><%=lr.getNickname()%></strong></A> 
<SPAN class=commentinfo>[<%=lr.getReplyTime().replace("-","/")%>]</SPAN>	<%if(session.getAttribute("login_user")!=null&&username.equals((String)session.getAttribute("login_user"))){%><a href="delreply">删除</a><%}%></div>
<div class=commentcontent 
id=commcontent_1674><%=lr.getReplyContent()%></div>
<%
	}
}
%></div>
<div style="FLOAT: right;margin-right:50px"><A title="返回顶部"
href="<%=basePath+"log/temp"+logNoStr%>#top"><IMG 
style="MARGIN-BOTTOM: -1px" alt="返回顶部"
src="images/top.gif" border=0> </A></div>
<div id=MsgContent style="WIDTH: 94%">
<div id=MsgHead>发表评论</div>
<div id=MsgBody>
<form id="replyform" name="replyform" method="post" action="replylog?id=<%=logNo%>" style="MARGIN: 0px">
  <p  style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px" 
    align=left>用户名：
    <label>
    <input name="nickname" type="text" class=userpass value="<%=session.getAttribute("login_user")==null?"":(String)session.getAttribute("login_user")%>"/>  
	 <%if(session.getAttribute("password")==null){%><a href="/login.xhtml">登录</a>
    </label>
  </p>

  <p  style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px" 
    align=left>
  密码：
    <label>
    <input name="password" class=userpass type="password" id="password"  />
    </label>
</p><%} else{%> </label>
  </p>
	<input name="password" class=userpass type="hidden" value="<%=(String)session.getAttribute("password")%>"/>

<% }%>
  <p  style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px" 
    align=left>验证码：
    <label>
    <input type="text" name="authencode" class="userpass" /><img src="AuthenCode?authenName=AuthenCode&heigth=20" align="absmiddle">
    </label>
  </p>
  <p  style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px" 
    align=left>回复内容：</p>
  <p>
    <label>
    <textarea name="replycontent"  cols="60" rows="10" class=editTextarea></textarea>
    </label>
  </p>
  <p>
    <label>
    <input name="Submit" type="submit" class="userpass" value="提交" />
    </label>
  	</form>
</div></div>
<div id=mainContent-bottomimg></div></div></div>
<%@ include file="/sidebar.jsp"%>
<%@ include file="/footer.jsp" %>
</body>
</html>
